﻿{extends file='main.tpl'}
{block name='title'}
    Validation du panier
{/block}
{block name='content'}
    {include file="informations_account.tpl"}
    <h1>Panier</h1>
    <table>
        {foreach name=outer item=shirt from=$shirts}
            <tr style="border: 1px solid gray;">
                <td><img id="shirt-img-{$shirt.id}" class="shirtThumb" src="img/shirts/{$shirt.id}-small.png" alt="shirt" /></td>
                <td>Reference: {$shirt.ref} <br />
                    Marque: {$shirt.brand} <br />
                    Description: {$shirt.description} <br />
                </td>
                <td>Taille: {$shirt.size} Couleur: {$shirt.color}<br />
                    Quantité: <span id="quantity-{$shirt.id}">{$shirt.quantity}</span> <br />
                    Prix: {$shirt.price} €<br />
                </td>
                <td>
                    Total: <span class="subTotal" >{$shirt.total}</span> €
                </td>
            </tr>
        {/foreach}
        <th colspan="2"></th>
        <th>
            <b>Frais de port</b><br />
            <b>Réduction</b><br />
            <b>Total</b><br />
        </th>
        <th>
			<span id="fraisPort"></span>€<br />
			<span id="reduction">0</span>€<br />
			<b><span id="totalFinal"></span>€</b><br />
        </th>
    </table>
    <a href="index.php?page=payement"><input type="button" name="pay" value="Payement" class="btnRight"></a>
{/block}

{block name='javascript'}
    <script type="text/javascript" src="pages/controller/js/store.js"></script>
    <script type="text/javascript" src="pages/controller/js/cart.js"></script>
    <script type="text/javascript">

	//JQuery main entry point
	$(document).ready(function() {
		{foreach name=outer item=shirt from=$shirts}
				changeShirtColorAndSex({$shirt.id}, '{$shirt.color}', '{$shirt.sex}');
				updateSubPrice({$shirt.id}, {$shirt.price})
		{/foreach}

	   updateTotalPrice();
	});
    </script>
{/block}